

#ifndef __CE_XML_H__
#define __CE_XML_H__

#include <cexml/ceexport.h>
#include <cecore/ifile.h>
#include <cecore/iqf.h>
#include <cecore/cetypes.h>
#include <string>
#include <list>
#include <map>

typedef struct _xmlDoc xmlDoc;
typedef struct _xmlNode xmlNode;

class CE_XML_API ceXmlElement
{
private:
	xmlNode*														node;

public:
	ceXmlElement (xmlNode* node);
	~ceXmlElement ();

	void AssignNode (xmlNode* node);
	bool IsValid () const;

	ceString GetTagName () const;

	ceString GetAttribute (const char* name, const char* defaultValue = 0) const;
	bool HasAttribute (const char* name) const;
	int GetIntAttribute (const char* attribute) const;
	float GetFloatAttribute (const char* attribute) const;

	ceString GetString () const;

	unsigned GetNumberOfChildren (const char* tagName = 0) const;
	ceXmlElement GetChild (const char* tagName = 0) const;
	ceXmlElement GetChild (unsigned idx, const char* tagName = 0) const;

};


class CE_XML_API ceXmlDocument 
{
private:
	xmlDoc*	doc;

public:

	ceXmlDocument ();

	bool IsValid () const;

	bool Open (const ceString& filename);
	bool Open (iFile* file);

	ceXmlElement GetRootElement () const;
};

#endif /* ! __CE_XML_H__ */ 
